From 04710d73b033070ab872960fcdda35b90b561278 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 9 Mar 2007 19:36:24 +0000 Subject: [PATCH] linux: Use new time hypercalls. Signed-off-by: Keir Fraser --- .../arch/i386/kernel/time-xen.c | 26 +++++++++++++++++-- linux-2.6-xen-sparse/drivers/xen/Kconfig | 7 +++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c index 4f2e155c7b..92971bcac6 100644 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c @@ -907,6 +907,10 @@ static void setup_cpu0_timer_irq(void) BUG_ON(per_cpu(timer_irq, 0) < 0); } +static struct vcpu_set_periodic_timer xen_set_periodic_tick = { + .period_ns = NS_PER_TICK +}; + void __init time_init(void) { #ifdef CONFIG_HPET_TIMER @@ -919,6 +923,10 @@ void __init time_init(void) return; } #endif + + HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0, + &xen_set_periodic_tick); + get_time_values_from_xen(0); processed_system_time = per_cpu(shadow_time, 0).system_timestamp; @@ -976,8 +984,10 @@ EXPORT_SYMBOL(jiffies_to_st); */ static void stop_hz_timer(void) { + struct vcpu_set_singleshot_timer singleshot; unsigned int cpu = smp_processor_id(); unsigned long j; + int rc; cpu_set(cpu, nohz_cpu_mask); @@ -997,8 +1007,15 @@ static void stop_hz_timer(void) j = jiffies + 1; } - if (HYPERVISOR_set_timer_op(jiffies_to_st(j)) != 0) - BUG(); + singleshot.timeout_abs_ns = jiffies_to_st(j); + rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot); +#ifdef XEN_COMPAT_030004 + if (rc) { + BUG_ON(rc != -ENOSYS); + rc = HYPERVISOR_set_timer_op(singleshot.timeout_abs_ns); + } +#endif + BUG_ON(rc); } static void start_hz_timer(void) @@ -1030,6 +1047,8 @@ void time_resume(void) init_cpu_khz(); for_each_online_cpu(cpu) { + HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu, + &xen_set_periodic_tick); get_time_values_from_xen(cpu); per_cpu(processed_system_time, cpu) = per_cpu(shadow_time, 0).system_timestamp; @@ -1050,6 +1069,9 @@ int local_setup_timer(unsigned int cpu) BUG_ON(cpu == 0); + HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu, + &xen_set_periodic_tick); + do { seq = read_seqbegin(&xtime_lock); /* Use cpu0 timestamp: cpu's shadow is not initialised yet. */ diff --git a/linux-2.6-xen-sparse/drivers/xen/Kconfig b/linux-2.6-xen-sparse/drivers/xen/Kconfig index 1f3e49f207..71ba9f264d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/Kconfig +++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig @@ -227,6 +227,9 @@ choice config XEN_COMPAT_030002_AND_LATER bool "3.0.2 and later" + config XEN_COMPAT_030004_AND_LATER + bool "3.0.4 and later" + config XEN_COMPAT_LATEST_ONLY bool "no compatibility code" @@ -236,6 +239,10 @@ config XEN_COMPAT_030002 bool default XEN_COMPAT_030002_AND_LATER +config XEN_COMPAT_030004 + bool + default XEN_COMPAT_030002_AND_LATER || XEN_COMPAT_030004_AND_LATER + endmenu config HAVE_IRQ_IGNORE_UNHANDLED -- 2.30.2